count = 1
while count <=5:
    print(f"当前数字:{count}")
    count += 1
print("循环结束!")



user_input =""
while user_input.lower() != "quit":
    user_input = input('输入消息(输入"quit"退出):')
    print(f"你输入了:{user_input}")


    password = "abc123"
    attempt = 3

    while attempt > 0:
        user_guess = input("请输入密码:")
        if user_guess == password:
            print("密码正确!")
            break
        else:
            attempt -= 1
            print(f"密码错误!剩余尝试次数:{attempt}")

    if attempt== 0:
        print("账户已锁定!")

import random

target = random.randint(1,100)


while True:
    guess = int(input("猜数字(1-100): "))
    if guess == target:
        print("恭喜猜中!")
        break
    elif guess > target:
        print("太大了!")
    else:
        print("太小了")
num = 0
while num < 10:
    num +=1
    if num % 2 == 0:
        continue
    print(f"奇数:{num}")
while True:
    age = input("请输入年龄(0-120):")
    if not age.isdigit():
        print("请输入数字!")
        continue
    age = int(age)
    if 0 <= age <= 120:
        break
    print("年龄无效!")
print(f"录入年龄:{age}岁")




total = 0
while True:
    price = input("输入商品价格(输入done结算):")
    if price.lower() =="done":
        break
    try:
        total += float(price)
    except ValueError:
        print("无效价格!")
        continue
    print(f"当前总计: ￥{total:.2f}")

    print(f"最终应付: ￥{total:.2f}")









